var i = Object.defineProperty;
var s = (u, t, r) =>
  t in u
    ? i(u, t, { enumerable: !0, configurable: !0, writable: !0, value: r })
    : (u[t] = r);
var o = (u, t, r) => (s(u, typeof t != 'symbol' ? t + '' : t, r), r);
import { _defaults as $ } from './defaults.js';
import { escape as a, cleanUrl as c } from './helpers.js';
class d {
  constructor(t) {
    o(this, 'options');
    this.options = t || $;
  }
  code(t, r, e) {
    var l;
    const n = (l = (r || '').match(/^\S*/)) == null ? void 0 : l[0];
    return (
      (t =
        t.replace(/\n$/, '') +
        `
`),
      n
        ? '<pre><code class="language-' +
          a(n) +
          '">' +
          (e ? t : a(t, !0)) +
          `</code></pre>
`
        : '<pre><code>' +
          (e ? t : a(t, !0)) +
          `</code></pre>
`
    );
  }
  blockquote(t) {
    return `<blockquote>
${t}</blockquote>
`;
  }
  html(t, r) {
    return t;
  }
  heading(t, r, e) {
    return `<h${r}>${t}</h${r}>
`;
  }
  hr() {
    return `<hr>
`;
  }
  list(t, r, e) {
    const n = r ? 'ol' : 'ul',
      l = r && e !== 1 ? ' start="' + e + '"' : '';
    return (
      '<' +
      n +
      l +
      `>
` +
      t +
      '</' +
      n +
      `>
`
    );
  }
  listitem(t, r, e) {
    return `<li>${t}</li>
`;
  }
  checkbox(t) {
    return (
      '<input ' + (t ? 'checked="" ' : '') + 'disabled="" type="checkbox">'
    );
  }
  paragraph(t) {
    return `<p>${t}</p>
`;
  }
  table(t, r) {
    return (
      r && (r = `<tbody>${r}</tbody>`),
      `<table>
<thead>
` +
        t +
        `</thead>
` +
        r +
        `</table>
`
    );
  }
  tablerow(t) {
    return `<tr>
${t}</tr>
`;
  }
  tablecell(t, r) {
    const e = r.header ? 'th' : 'td';
    return (
      (r.align ? `<${e} align="${r.align}">` : `<${e}>`) +
      t +
      `</${e}>
`
    );
  }
  /**
   * span level renderer
   */
  strong(t) {
    return `<strong>${t}</strong>`;
  }
  em(t) {
    return `<em>${t}</em>`;
  }
  codespan(t) {
    return `<code>${t}</code>`;
  }
  br() {
    return '<br>';
  }
  del(t) {
    return `<del>${t}</del>`;
  }
  link(t, r, e) {
    const n = c(t);
    if (n === null) return e;
    t = n;
    let l = '<a href="' + t + '"';
    return r && (l += ' title="' + r + '"'), (l += '>' + e + '</a>'), l;
  }
  image(t, r, e) {
    const n = c(t);
    if (n === null) return e;
    t = n;
    let l = `<img src="${t}" alt="${e}"`;
    return r && (l += ` title="${r}"`), (l += '>'), l;
  }
  text(t) {
    return t;
  }
}
export { d as _Renderer };
